
	var spanList = document.getElementsByClassName("placeholder");
	var inputList  = document.getElementsByClassName("field");
    function checkinput(which){
     	var inputName = which.getAttribute("name");
     	var regtxt = "";
     	switch(inputName){
     		case "regPhone":
     		    regtxt = /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/;
     		break;
     		case "regName":
     		    regtxt = /^[a-zA-Z0-9_-]{4,16}$/;
     		break;
     		
     }
     	if(regtxt.test(which.value)){
     			return;
     		}else{
     			which.parentNode.nextSibling.nextSibling.innerHTML = which.getAttribute("warning");
     			which.parentNode.style.border = "1px solid red";
     		}
}
	for (var i=0;i<spanList.length;i++) {
		spanList[i].onclick = function(){
			this.style.display = "none";
			this.nextSibling.nextSibling .focus();
		}
	}
	
	for (var i = 0;i<inputList.length;i++) {
		inputList[i].onblur = function(){
			checkinput(this);
		}
	}
